package com.dcd.controller;

import ch.qos.logback.core.net.SyslogOutputStream;
import com.dcd.mapper.Car_modelMapper;
import com.dcd.pojo.*;
import com.dcd.service.Car_modelService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class Car_modelController {

    @Autowired
    private Car_modelService cs;


    /**
     * 查询所有车型
     * @param car_series_id 车系id
     * @return
     */
    @RequestMapping("/modelList")
    public List<Car_model> modelList(@RequestParam int car_series_id){
        return  cs.selectModel(car_series_id);
    }

    /**
     * 按车型id查询亮点配置
     * @param car_model_id 车型id
     * @return
     */
    @RequestMapping("/highlights_configList")
    public List<Highlights_configuration> highlights_configList(@RequestParam int car_model_id){
        return cs.selectConfig(car_model_id);
    }

    /**
     * 按车型id查询详细配置
     * @param car_model_id 车型id
     * @return
     */
    @RequestMapping("/select_car_model_ById")
    public Car_model select_car_model_ById(@RequestParam int car_model_id){
        return cs.selectBymodelId(car_model_id);
    }

    /**
     * 车型首页中的热门咨询
     * @param car_model_id 车型id
     * @return
     */
    @RequestMapping("/select_information")
    public List<Information> select_information(@RequestParam int car_model_id){
        return cs.selectinformation(car_model_id);
    }

    /**
     * 根据车名查询车系
     * @param brand_id 车名称id
     * @return
     */
    @RequestMapping("/select_Car_series")
    public List<Car_series> select_Car_series(@RequestParam int brand_id){
        return cs.selectCar_series(brand_id);
    }

    /**
     * 查询车型页面图片内饰，外观，空间
     * @param car_model_images_type_id 大图类型id
     * @param brand_id 车系id
     * @return
     */
    @RequestMapping("/selectCar_model_images")
    public Car_model_images selectCar_model_images(@RequestParam int car_model_images_type_id, @RequestParam int brand_id){
        return cs.selectCar_model_images(car_model_images_type_id,brand_id);
    }

    /**
     * 获取亮点配置图片数量
     * @param car_model_id  车型id
     * @return
     */
    @RequestMapping("/getConfigImgCount")
    public Highlights_configuration getConfigImgCount(@RequestParam int car_model_id){
        return cs.getConfigImgCount(car_model_id);
    }

    /**
     * 根据id查询购车计算
     * @param car_model_id  车型id
     * @return
     */
    @RequestMapping("/select_car_purchase_calculation")
    public Car_model select_car_purchase_calculation(@RequestParam int car_model_id){
        return cs.select_car_purchase_calculation(car_model_id);
    }




    /**
     * 根据品牌id或者车系id或者车型id查询选车当前位置（当前位置：选车->本田->雅阁）
     * @param brand_id   //品牌id
     * @param car_series_id  //车系id
     * @param car_model_id  //车型id
     * @return
     */
    @RequestMapping("/selectBy_brand_series_model_Id")
    public Car_series selectBy_brand_series_model_Id(@RequestParam int brand_id,@RequestParam int car_series_id,@RequestParam int car_model_id){
         return cs.selectBy_brand_series_model_Id(brand_id,car_series_id,car_model_id);
    }
    
}
